package com.bjdd.jdy.entity;

import com.bigkoo.pickerview.model.IPickerViewData;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2017/4/12.
 */

public class AreaBean implements IPickerViewData{

    /**
     * areaId : 1
     * areaName : 鼓楼区
     * areaCode : 350102
     * enable : true
     */

    private int areaId;
    private String areaName;
    private String areaCode;
    private boolean enable;

    public static AreaBean objectFromData(String str) {

        return new Gson().fromJson(str, AreaBean.class);
    }

    public static List<AreaBean> arrayAreaBeanFromData(String str) {

        Type listType = new TypeToken<ArrayList<AreaBean>>() {
        }.getType();

        return new Gson().fromJson(str, listType);
    }

    public int getAreaId() {
        return areaId;
    }

    public void setAreaId(int areaId) {
        this.areaId = areaId;
    }

    public String getAreaName() {
        return areaName;
    }

    public void setAreaName(String areaName) {
        this.areaName = areaName;
    }

    public String getAreaCode() {
        return areaCode;
    }

    public void setAreaCode(String areaCode) {
        this.areaCode = areaCode;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    @Override
    public String getPickerViewText() {
        return areaName;
    }
}
